package com.richest.api.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.richest.api.dao.EmployeeMapper;
import com.richest.api.service.IEmployeeService;
import com.richest.bean.EmployeeBean;

/**
 * 员工信息管理服务接口实现
 * 
 * @author 杨博
 * @version richest-api 2.0
 *
 */
@Service
public class EmployeeServiceImpl implements IEmployeeService {

	@Autowired
	private EmployeeMapper mapper;

	@Override
	public Long employeeAdd(EmployeeBean bean) {
		return mapper.employeeAdd(bean);
	}

	@Override
	public Integer employeeUpdate(EmployeeBean bean) {
		return mapper.employeeUpdate(bean);
	}

	@Override
	public Integer employeeDelete(Long id) {
		return mapper.employeeDelete(id);
	}

	@Override
	public EmployeeBean employeeSelectOneById(Long id) {
		return mapper.employeeSelectOneById(id);
	}

	@Override
	public List<EmployeeBean> employeeSelectListByMerchantId(Long merchantId, Integer beginNumber, Integer endNumber) {
		Map<String, Object> params = new HashMap<>();
		params.put("column", "merchant_id");
		params.put("value", merchantId);
		params.put("beginNumber", beginNumber);
		params.put("endNumber", endNumber);
		return mapper.employeeSelectListByMerchantId(params);
	}

	@Override
	public EmployeeBean employeeLogin(String logName, String password) {
		Map<String, Object> params = new HashMap<>();
		params.put("log_name", logName);
		params.put("password", password);
		return mapper.employeeLogin(params);
	}

}
